﻿using GrainManage.Entities.Type;
using System;

namespace GrainManage.Server.Business
{
    public class TypeBusiness : BaseBusiness, GrainManage.Interface.IType
    {
        public OutputGetNameByFlag GetNameByFlag(InputGetNameByFlag input)
        {
            var result = new OutputGetNameByFlag();
            try
            {
                var service = ObjectFactory.TypeService;
                var list = service.GetNameByFlag(input.Flag, input, result);
                if (list != null && list.Count > 0)
                {
                    result.Types = list;
                    SetResponse(StatusCode.Success, input, result);
                }
                else
                {
                    SetResponse(StatusCode.NoData, input, result);
                }
            }
            catch (Exception e)
            {
                SetResponse(StatusCode.Failed, input, result, e);

            }

            return result;
        }
    }
}